package com.zto.wk.service;

import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * Created by wangkuan at 2018-11-07 20:36
 */
@Service
public class HomeService {

    @Cacheable(value = "cacheTest", key = "#key")
    public String getTime(int key) {
        return LocalDateTime.now().toString();
    }

    @CachePut(value = "cacheTest", key = "#key")
    public String getTime2(int key) {
        return LocalDateTime.now().toString() + " ======= 2 ========";
    }
}
